package com.atguigu.gulimall.product.service;

import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.product.entity.BrandEntity;
import com.atguigu.gulimall.product.entity.CategoryBrandRelationEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 品牌分类关联
 *
 * @author huguangwei
 * @email huguangwei@gmail.com
 * @date 2022-10-07 20:12:13
 */
public interface CategoryBrandRelationService extends IService<CategoryBrandRelationEntity> {

    PageUtils queryPage(Map<String, Object> params);

    @Transactional
    void saveDetail(CategoryBrandRelationEntity categoryBrandRelation) throws RuntimeException;

    /**
     * 更新关联表中品牌信息
     *
     * @param brandId
     * @param name
     */
    @Transactional
    void updateBrand(Long brandId, String name) throws RuntimeException;

    /**
     * 更新关联表中分类信息
     *
     * @param catelogId
     * @param name
     * @throws RuntimeException
     */
    @Transactional
    void updateCategory(Long catelogId, String name) throws RuntimeException;

    /**
     * 获取分类关联的品牌
     *
     * @param catId
     * @return
     */
    List<BrandEntity> getBrandsByCatId(Long catId);
}

